// 系统配置
var CONFIG = {
  // 开启缩放
  scale: false,
  normalVideoUrl: 'http://10.131.160.237:19000'
}

var PAGES = ['index.html', 'window.html']
// switchPage({ delay: 1000 * 60 * 5 })

/**
 * 切换页面
 * @param {Object} opt 配置项
 *  目前支持的配置项：
 *    delay: 延迟时间，单位 ms
 */
function switchPage(opt) {
  var currentPage = ''
  var nextPage = ''
  var rootPath = ''

  for (var i = 0; i < PAGES.length; i++) {
    var page = PAGES[i]
    var temp = location.pathname.substr(-page.length)
    if (page === temp) {
      if (!currentPage || page.length > currentPage.length) {
        currentPage = page
        rootPath = location.pathname.substr(
          0,
          location.pathname.length - page.length
        )
        nextPage = PAGES[i + 1]

        if (!nextPage) {
          nextPage = PAGES[0]
        }
      }
    }
  }

  setTimeout(function () {
    location.href = rootPath + nextPage
  }, opt.delay)
}
function getNowDate (){
  var date = new Date();
  var sign2 = ":";
  var year = date.getFullYear() // 年
  var month = date.getMonth() + 1; // 月
  var day = date.getDate(); // 日
  var hour = date.getHours(); // 时
  var minutes = date.getMinutes(); // 分
  var seconds = date.getSeconds() //秒
  var weekArr = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'];
  var week = weekArr[date.getDay()];
  // 给一位数的数据前面加 “0”
  if (month >= 1 && month <= 9) {
      month = "0" + month;
  }
  if (day >= 0 && day <= 9) {
      day = "0" + day;
  }
  if (hour >= 0 && hour <= 9) {
      hour = "0" + hour;
  }
  if (minutes >= 0 && minutes <= 9) {
      minutes = "0" + minutes;
  }
  if (seconds >= 0 && seconds <= 9) {
      seconds = "0" + seconds;
  }
  return year  + month + day + " " + hour  + minutes + seconds;
}

